﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

using Microsoft.Xna.Framework;
using Microsoft.Xna.Framework.Audio;
using Microsoft.Xna.Framework.Content;
using Microsoft.Xna.Framework.GamerServices;
using Microsoft.Xna.Framework.Graphics;
using Microsoft.Xna.Framework.Input;
using Microsoft.Xna.Framework.Media;

using AwesomeEnginePC.Physics;
using AwesomeEnginePC.Graphics.TwoDimensional.Sprites;

namespace AwesomeEnginePC.Graphics.TwoDimensional.Menus
{
    public enum MenuButtonStatus
    {
        NotSelected = 0,
        Hovering,
        Pressed,
    }

    public class MenuButton
    {
        /* a button is just a 3 BaseSprites:
         * -normal (not selected)
         * -hover
         * -pressed in
         */

        private ContentManager _cm;

        private BaseSprite _notSelectedSprite;
        private BaseSprite _hoveringSprite;
        private BaseSprite _pressedSprite;

        public MenuButton ButtonN { get; set; }
        public MenuButton ButtonNE { get; set; }
        public MenuButton ButtonNW { get; set; }
        public MenuButton ButtonE { get; set; }
        public MenuButton ButtonW { get; set; }
        public MenuButton ButtonS { get; set; }
        public MenuButton ButtonSE { get; set; }
        public MenuButton ButtonSW { get; set; }

        public Vector Position
        {
            get
            {
                return _notSelectedSprite.Position;
            }
            set
            {
                _notSelectedSprite.Position = value;
                _hoveringSprite.Position = value;
                _pressedSprite.Position = value;
            }
        }

        public int Height
        {
            get
            {
                return _notSelectedSprite.Height;
            }
            set
            {
                _notSelectedSprite.Height = value;
                _hoveringSprite.Height = value;
                _pressedSprite.Height = value;
            }
        }

        public int Width
        {
            get
            {
                return _notSelectedSprite.Width;
            }
            set
            {
                _notSelectedSprite.Width = value;
                _hoveringSprite.Width = value;
                _pressedSprite.Width = value;
            }
        }

        public MenuButton(ContentManager cm, string notSelectedAssetName, string hoveringAssetName, string pressedAssetName)
        {
            _cm = cm;
            _notSelectedSprite = new BaseSprite(_cm, notSelectedAssetName);
            _hoveringSprite = new BaseSprite(_cm, hoveringAssetName);
            _pressedSprite = new BaseSprite(_cm, pressedAssetName);
        }

        public MenuButton(ContentManager cm, BaseSprite notSelectedSprite, BaseSprite hoveringSprite, BaseSprite pressedSprite)
        {
            _cm = cm;
            _notSelectedSprite = notSelectedSprite;
            _hoveringSprite = hoveringSprite;
            _pressedSprite = pressedSprite;
        }
    }
}
